<!-- 社区 -->
<template>
  
  <!-- 精品推荐 -->
  <div
    style="background-color: white;width: 330px;padding-top: 10px;padding-bottom: 20px;margin-right: 30px;float: right;margin-top: 40px;">
    <h3 style="border-bottom: 1px solid rgb(228, 227, 227);margin-top: 10px;margin-left: 20px;">精品推荐</h3>
    <el-col v-for="(item, index) in carouselData" :key="index" :span="16" :offset="index > 16 ? 8 : 3"
      style="margin-left: 26px;">
      <el-card :body-style="{ padding: '5px' }" style="width: 280px;margin-top: 20px">
        <img :src="item.courseCover" style="width: 270px;" />
        <div style="padding: 14px;text-align: center;height: 40px;">
          <span class="crousename">{{ item.courseName }}</span>
        </div>
        <div style="height: 35px;">
          <span class="cprice">{{ '￥' + item.courseCPrice }}</span>
          <span class="oprice">{{ '￥' + item.courseOPrice }}</span>
        </div>
      </el-card>
    </el-col>
  </div>

  

  <RouterView></RouterView>
</template>

<script lang="ts" setup>
// import type { UploadProps, UploadUserFile } from 'element-plus'
import { ref, reactive } from 'vue'
import axios from '../../api/index';
// import { da, el } from 'element-plus/es/locale';
// import { ElMessage } from "element-plus";
import { useRouter } from 'vue-router';
import { Delete, Download, Plus, ZoomIn } from '@element-plus/icons-vue'
import { ElMessage } from "element-plus";


const router = useRouter();
const buttonType = ref('success')

// 从localStorage中获取存储的JSON字符串  
const userInfoJsonString = localStorage.getItem('userInfo')!;

// 解析JSON字符串为JavaScript对象  
const userInfo = JSON.parse(userInfoJsonString);
// import axios from 'axios' // 引入axios库进行HTTP请求  

const dialogFormVisible = ref(false)

const carouselData = ref([] as any[]);

getcarouseData();

function getcarouseData() {
  axios.get('/course/findBestCourses')
    .then((resp) => {
      if (resp.code === 200) {
        // console.log(response.data);
        carouselData.value = resp.data;
      }
    })
}







//==================


</script>